﻿<%@ Page Language="C#" MasterPageFile="~/U_masterP.master" AutoEventWireup="true"
    CodeFile="collectionDetail.aspx.cs" Inherits="collectionDetailPage" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register Src="uc_main/sideBar_right.ascx" TagName="sideBar_right" TagPrefix="uc1" %>
<%@ Register Src="uc_main/menu_canhan.ascx" TagName="menu_canhan" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <style>
        #content_left2
        {
            width: 100%;
            margin: 0px 0px;
            float: left;
            position: relative;
            min-height: 700px;
        }
    </style>
    <div id="content_top">
        <%--<asp:CheckBox ID="CheckBox1" runat="server"/>--%>
        <div id="kep">
            <a href="#">Trang cá nhân</a></div>
        <div id="tags">
            <div id="result">
            </div>
            <% if (Session["KhachHang"] != null)
               { %>
            <div id="Iwill">
                Tôi sẽ
                <asp:TextBox ID="TextBox1" CssClass="txtTieptuc" Width="400px" runat="server" MaxLength="200"></asp:TextBox>
                chỉ với 5$.
                <ajaxToolkit:FilteredTextBoxExtender ID="TextBox1_FilteredTextBoxExtender" runat="server"
                    FilterMode="InvalidChars" InvalidChars="!@#$%^&amp;*()_-+=\|{}[]&quot;':,&lt;&gt;.?/"
                    TargetControlID="TextBox1">
                </ajaxToolkit:FilteredTextBoxExtender>
                <div id="btn_tieptuc">
                    <asp:Button ID="btnTiep2" CssClass="tieptuc" runat="server" OnClientClick="return checkTT()"
                        Text="Tiếp tục" OnClick="btnTiep2_Click" /></div>
            </div>
            <% }
               else { } %>
        </div>
        <%--<a href="#">
                    <img alt="X" src="img/dky.png" /></a>--%>
    </div>
    <div class="clear">
    </div>
    <div id="sub_content">
        <div id="content_left2">
            <!-- noi dung chinh -->
            <uc2:menu_canhan ID="menu_canhan1" runat="server" />
            <input type="hidden" runat="server" id="hdGig" />
            <div class="box">
                <%--<div class="linkEdit">
                    <div class="dacbiet" style="float: right; margin-bottom: 5px">
                        <a href="#collection-create" name="signup" rel="leanModal" id="collection-modal">thêm
                            mới</a>
                       
                    </div>
                </div>--%>
            </div>
            <div id="main_canhan">
              <%--  <div id="Loader">
                    <div id="loadingbox">
                        <br />
                        <br />
                        <br />
                        processing</div>
                    <div id="progressBackgroundFilter">
                    </div>
                </div>--%>
                <asp:Repeater runat="server" ID="rptCollectionDetail">
                    <ItemTemplate>
                        <div class="thongtin">
                            <a href="~/../gigdetails.aspx?c=<%# Eval("Gig.idCategory") %>&g=<%# Eval("Gig.idGig") %>"
                                class="avatar">
                                <img src='<%# Eval("Gig.UrlHinh1","upload/{0}") %>' width="122px" height="86" />
                            </a>
                            <div class="mota" style="width: 760px">
                                <p class="tieudeMota">
                                    <a href="~/../gigdetails.aspx?c=<%# Eval("Gig.idCategory") %>&g=<%# Eval("Gig.idGig") %>">
                                        Tôi sẽ
                                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("Gig.TenCongViec") %>'></asp:Label>
                                        chỉ với 5$</a></p>
                                <p class="motangan">
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("Gig.MoTaCV")%>'></asp:Label>
                                    ...( đăng bởi <span class="posted">
                                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("Gig.VLGAccount.UsernameE") %>'></asp:Label></span>
                                    <img src='img/flags/<%# Eval("Gig.VLGAccount.ipAddress") %>.png' title='<%# Eval("Gig.VLGAccount.TenQuocGia") %>' />
                                    )</p>
                                <br />
                                <p class="d">
                                    <div class="d_head">
                                        <ul>
                                            <li><a href="~/../gigdetails.aspx?c=<%# Eval("Gig.idCategory") %>&g=<%# Eval("Gig.idGig") %>"
                                                class="nhungChitiet">Chi tiết</a></li>
                                            <% if (Session["KhachHang"] == null)
                                               { %>
                                            <li><a href="signin.aspx" class="nhungHome">Đăng nhập</a></li>
                                            <% }
                                               else { } %>
                                            <li><a href="#" class="nhungChiaSe">Chia sẻ</a></li>
                                            <li><a class="collection-detail-delete" id="collection_<%#Eval("idCollectiondDetail") %>"
                                                href="<%#Eval("idCollectiondDetail") %>">Xóa khỏi bộ sưu tập</a> </li>
                                        </ul>
                                    </div>
                                    <div class="d_end">
                                        <a class="btn" <% if(Session["KhachHang"]==null) { %> href="signin.aspx" <% } else { %>
                                            href='datHang.aspx?id=<%# Eval("Gig.idGig") %>' <% } %>><span class="btn_nd">Đặt hàng
                                                (5$)</span> <span class="btn_nd2">Đặt hàng (5$)</span> </a>
                                    </div>
                                </p>
                            </div>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
                <div class="pager">
                    <webdiyer:AspNetPager ID="AspNetPager1" runat="server" HorizontalAlign="Left" Width="100%"
                        PageIndexBoxType="DropDownList" PageSize="10" OnPageChanged="AspNetPager1_PageChanged"
                        AlwaysShowFirstLastPageNumber="true" FirstPageText="First" PrevPageText="Previous"
                        NextPageText="Next" LastPageText="Last">
                    </webdiyer:AspNetPager>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            //Loader(false);
            //$(".collection-delete").click(function () {
            $(".collection-detail-delete").live("click", function () {
                var answer = confirm('Bạn muốn xóa công việc này ra khỏi bộ sưu tập?');
                if (answer) {
                    //lay id cua thẻ a đang dc click
                    var id = $(this).attr("id");
                    //  $("#img-loading").show();
                   // Loader(true);
                    $.ajax({
                        type: "POST",
                        url: "collectionDetail.aspx/DeleteCollectionDetail",
                        data: '{idCollectionDetail: "' + $(this).attr("href") + '" }',
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        // success: OnSuccess(id),
                        success: function (response) {
                            if (response.d == 0) {
                                alert("Có lỗi xảy ra, vui lòng thực hiện lai");
                                //Loader(false);
                                //$("#img-loading").hide();
                            }
                            else if (response.d == 1) {
                                //$("#img-loading").hide();
                                $("#" + id).parent().parent().parent().parent().parent().remove();
                               // Loader(false);
                            }

                        },
                        failure: function (response) {
                            alert("Có lỗi xảy ra, vui lòng thực hiện lai");
                            //$("#img-loading").hide();
                           // Loader(false);
                        }
                    });
                }
                return false;
            });

            function checkTT() {
                if ($('.txtTieptuc').val() == "") {
                    alert('Không được để trống ');
                    $('.txtTieptuc').focus();
                    return false;
                }
            }

        })
    </script>
</asp:Content>
